#pragma once

#include "ColumnTreeData.h"
#include "NodeSorter.h"
//#include "sharePtrWrap.h"

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::Collections::Generic;

typedef System::Windows::Forms::TreeNode TreeNodeUI;

using namespace Bearinglib;
using namespace ColumnTreeData; 

namespace TSD {

	System::Void ShowTreeNode(TreeNodeUI^ ndparent,IParamgroup ^ grpnode);

	void ListBearingtype(Bearinglib::BearingType ^ btnode,MultiColHeaderDgv::MultiColHeaderDgvControl^);
	
 ref class UT
	{
	public: static paramgroup^ namenod = gcnew paramgroup();
	};
	

	ref class Sortedparam
	{
		static void getsortedparam1(List<param ^>^ li,TreeNodeUI^ node)
		{
			Group ^ arp = safe_cast<Group ^>(node->Tag);
			if(arp->m_grop->type == paramgrouptype::leaf)
			{
				if(arp->m_grop->m_param)
					li->Add(safe_cast<Bearinglib::param ^>(arp->m_grop->m_param) );
			}
			else
			{
				for each(TreeNodeUI^ node_s in node->Nodes)
				{
					getsortedparam1(li,node_s);
				}
			}
		}

	public:

		static void getsortedparam(List<param ^>^ li,TreeView^ tree)
		{
			for each(TreeNodeUI^ node_s in tree->Nodes)
			{
				getsortedparam1(li,node_s);
			}
		}
	};
}